import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../edit_attract/logic.dart';

/// @Author : 王亚东

/// @Time : On 2022/9/14 14:58



class ItemPic extends StatelessWidget {


  ItemPic( this.index);

  int index;
  final logic = Get.find<EditAttractLogic>();
  final state = Get.find<EditAttractLogic>().state;
  @override
  Widget build(BuildContext context) {
    return Stack(children: [
      Image.file(File(state.listImagePaths[index].path!),fit: BoxFit.cover,width: 120,height: 120,),

      GestureDetector(child: Align(child: Icon(Icons.cancel,color: Colors.black,size: 20,),alignment: Alignment.topRight,),onTap: (){

          state.listImagePaths.removeAt(index);
          state.multipartFiles.removeAt(index);
          logic.update();

      },)
    ],);
  }
}
